package com.neulogistics.contrib.usercenter.api.application.converter;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neulogistics.infrastructure.common.query.PageViewModel;

public class PageVMConverter {
    public static <T> PageViewModel<T> pageToVM(Page<T> page){
        PageViewModel<T> pageViewModel = new PageViewModel<>();
        pageViewModel.setList(page.getRecords());
        pageViewModel.setPageNum(page.getCurrent());
        pageViewModel.setPageSize(page.getSize());
        pageViewModel.setTotal(page.getTotal());
        return pageViewModel;
    }
}
